  set more off 
  clear

  use "C:\Users\Lenovo\Desktop\主回归数据集.dta"

  **1.基准回归
  
  global control top1 growth size_log lev Board
  
  reghdfe GI digital, noabsorb vce(cluster id)
  est store m1
  
  reghdfe GI digital $control, noabsorb vce(cluster id)
  est store m2
  
  reghdfe GI digital $control, absorb(year id) vce(cluster id)
  est store m3
  
  estfe m*, labels(year "年份固定效应" id "企业固定效应")
  esttab m1 m2 m3 using "C:\Users\Lenovo\Desktop\result.rtf", replace se star(* 0.1 ** 0.05 *** 0.01) b(%6.4f) compress nogap stats(N r2, fmt(%12.0f %9.4f)) indicate(`r(indicate_fe)') mtitle("GI" "GI" "GI") 
  
  **2.稳健性回归
  **更换核心被解释变量
  reghdfe GI1 digital $control, absorb(id year) vce(cluster id)
  est store r1
  **更换解释变量
  reghdfe GI digital1 $control, absorb(id year) vce(cluster id)
  est store r2
  **加入行业固定效应。为了防止行业层面遗漏变量对本文实证结果造成影响，本文在控制了个体固定效应和时间固定效应的情况下加入行业固定效应进行回归。
  reghdfe GI digital $control, absorb(id year indu) vce(cluster id)
  est store r3
    
  estfe r1 r2 r3, labels(indu "Ind FE" year "Year FE"  id "Firm FE")
  esttab r1 r2 r3 using "C:\Users\Lenovo\Desktop\result1.rtf", replace se star(* 0.1 ** 0.05 *** 0.01) b(%6.4f) compress nogap stats(N r2, fmt(%12.0f %9.4f)) indicate(`r(indicate_fe)') mtitle("GI1" "GI" "GI") 

  **3.内生性处理
  **工具变量
  eststo m1:ivreghdfe GI $control (digital=iv_digital),absorb(id year) cluster(id) first savefirst savefprefix(first_)
  estadd scalar idp = `e(idstat)': first_digital
  estadd scalar F = `e(widstat)' : first_digital

  
  esttab first_digital m1 using "C:\Users\Lenovo\Desktop\result1.rtf", replace   ///
  coeflabels(_cons "con")    ///
  b(4) se(4) compress nogaps scalar(F)  ///
  order(iv_digital digital $control)   ///
  stats(N r2 idp F , fmt(%12.0f %9.4f) labels("Obs" "R2""KP-LM" "KP-F"))   ///
  nobaselevels star(* 0.10 ** 0.05 *** 0.01)
  
  
  **4.机制检验
  *a.资源整合效应
  reghdfe tfp3 digital $control, absorb(id year) vce(cluster id)
  est store p1
  
  *b.媒体关注效应
  reghdfe News1 digital $control, absorb(id year) vce(cluster id)
  est store p2

  *c.融资约束效应
  
  estfe p1 p2, labels(year "年份固定效应" id "企业固定效应")
  esttab p1 p2 using "C:\Users\Lenovo\Desktop\result.rtf", replace se star(* 0.1 ** 0.05 *** 0.01) b(%6.4f) compress nogap stats(N r2, fmt(%12.0f %9.4f)) indicate(`r(indicate_fe)') mtitle("TFP" "News") append
  
 
 
  **5.异质性检验-企业规模
  reghdfe GI digital $control if firm_size == "大规模", absorb(id year) vce(cluster id)
  est store h1

  reghdfe GI digital $control if firm_size == "小规模", absorb(id year) vce(cluster id)
  est store h2

  estfe h1 h2, labels(year "年份固定效应" id "企业固定效应")
  esttab h1 h2 using "C:\Users\Lenovo\Desktop\result1.rtf", replace se star(* 0.1 ** 0.05 *** 0.01) b(%6.4f) compress nogap stats(N r2, fmt(%12.0f %9.4f)) indicate(`r(indicate_fe)') mtitle( "大规模企业'""中小规模企业") append
